package com.linsen.core.common.context;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * 租户数据上下文
 *
 * @author zhaoyong
 * @date 2023/3/11
 */
public final class TenantContextHolder {
    private final static TransmittableThreadLocal<String> TENANT_CONTEXT = new TransmittableThreadLocal<>();

    public static void setTenantId(String tenantId) {
        TENANT_CONTEXT.set(tenantId);
    }

    public static String getTenantId() {
        return TENANT_CONTEXT.get();
    }

    public static void removeTenantId() {
        TENANT_CONTEXT.remove();
    }
}
